﻿using UnityEngine;
using System.Collections;
using UnityStandardAssets.ImageEffects;

public class FocusCamera :MonoBehaviour
{
    public Camera fathorCam;
    public Camera childCam;


    void OnEnable()
    {
        //childCam.CopyFrom( fathorCam );
        childCam.clearFlags = CameraClearFlags.Depth;
        
        //childCam.cullingMask = 0xa;
        childCam.depth = fathorCam.depth+1;


        childCam.fieldOfView = fathorCam.fieldOfView;
        childCam.hdr = fathorCam.hdr;
        childCam.nearClipPlane = fathorCam.nearClipPlane;
        childCam.farClipPlane = fathorCam.farClipPlane;
        childCam.orthographic = fathorCam.orthographic;
        childCam.orthographicSize = fathorCam.orthographicSize;
        childCam.projectionMatrix = fathorCam.projectionMatrix;

        UICamera.mainCamera.gameObject.GetComponent<Camera>().depth=childCam.depth+1;
    }

    void OnDisable()
    {
        
    }
}
